﻿<!-- 
This resource dictionary is used by the MainWindow. 
-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:vm="clr-namespace:Neudesic.AzureStorageExplorer.ViewModel"
  xmlns:vw="clr-namespace:Neudesic.AzureStorageExplorer.View"
  xmlns:controls="clr-namespace:Neudesic.AzureStorageExplorer.Controls"
  xmlns:local="clr-namespace:Neudesic.AzureStorageExplorer.Controls"
  >

    <Style x:Key="TabItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="3,3,3,1"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <SolidColorBrush x:Key="TabControlNormalBorderBrush" Color="#8C8E94"/>
    <LinearGradientBrush x:Key="TabItemHotBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#EAF6FD" Offset="0.15"/>
        <GradientStop Color="#D9F0FC" Offset=".5"/>
        <GradientStop Color="#BEE6FD" Offset=".5"/>
        <GradientStop Color="#A7D9F5" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="TabItemSelectedBackground" Color="#F9F9F9"/>
    <SolidColorBrush x:Key="TabItemHotBorderBrush" Color="#3C7FB1"/>
    <SolidColorBrush x:Key="TabItemDisabledBackground" Color="#F4F4F4"/>
    <SolidColorBrush x:Key="TabItemDisabledBorderBrush" Color="#FFC9C7BA"/>

            <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
                <GradientStop Color="#F3F3F3" Offset="0"/>
                <GradientStop Color="#EBEBEB" Offset="0.5"/>
                <GradientStop Color="#DDDDDD" Offset="0.5"/>
                <GradientStop Color="#CDCDCD" Offset="1"/>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="ButtonOverBackground" EndPoint="0,1" StartPoint="0,0">
                <GradientStop Color="#FFFAFAFA" Offset="0"/>
                <GradientStop Color="#FFE0E0E3" Offset="1"/>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="ButtonPressedBackground" EndPoint="0,1" StartPoint="0,0">
                <GradientStop Color="#FFE0E0E2" Offset="0"/>
                <GradientStop Color="#FFF8F8F8" Offset="1"/>
            </LinearGradientBrush>
            <SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF969696"/>
            <Style x:Key="CloseableTabItemButtonStyle" TargetType="{x:Type Button}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
                <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="Padding" Value="4"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <Grid>
                                <Border SnapsToDevicePixels="true" x:Name="Chrome" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2" Opacity="0" />
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Opacity" TargetName="Chrome" Value="1"/>
                                    <Setter Property="Background" TargetName="Chrome" Value="{DynamicResource ButtonOverBackground}" />
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Opacity" TargetName="Chrome" Value="1"/>
                                    <Setter Property="Background" TargetName="Chrome" Value="{DynamicResource ButtonPressedBackground}" />
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="#ADADAD"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

    <ImageBrush x:Key="WindowBackground" Stretch="Fill" 
                ImageSource="images/WaveBlue.png" />

    <DataTemplate DataType="{x:Type vm:StorageAccountViewModel}">
        <vw:StorageAccountView />
    </DataTemplate>

  <!-- 
  This style configures both of the main content areas in the main window.
  -->
  <Style x:Key="MainHCCStyle" TargetType="{x:Type HeaderedContentControl}">
    <Setter Property="HeaderTemplate">
      <Setter.Value>
        <DataTemplate>
          <Border 
            Background="{StaticResource Brush_HeaderBackground}" 
            BorderBrush="LightGray" 
            BorderThickness="1" 
            CornerRadius="5" 
            Margin="4" 
            Padding="4" 
            SnapsToDevicePixels="True" 
            HorizontalAlignment="Stretch" 
            >
            <TextBlock 
              FontSize="14"
              FontWeight="Bold"
              Foreground="White" 
              HorizontalAlignment="Center"  
              Text="{TemplateBinding Content}" 
              />
          </Border>
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <!-- 
        This template ensures that content of a HeaderedContentControl 
        fills the available vertical space. 
        -->
        <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
          <DockPanel>
            <ContentPresenter 
              ContentSource="Content" 
              ContentTemplate="{TemplateBinding ContentTemplate}" 
              />
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!--
  This style ensures that the borders in the main window are consistent.
  -->
  <Style x:Key="MainBorderStyle" TargetType="{x:Type Border}">
    <Setter Property="Background" Value="WhiteSmoke" />
    <Setter Property="BorderBrush" Value="LightGray" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="CornerRadius" Value="5" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>

  <!--
  This template explains how to render the list of commands on the left
  side in the main window (the 'Control Panel' area).
  -->
  <DataTemplate x:Key="CommandsTemplate">
    <ItemsControl IsTabStop="False" ItemsSource="{Binding}" Margin="6,2">
      <ItemsControl.ItemTemplate>
        <DataTemplate>
          <TextBlock Margin="2,6">
            <Hyperlink Command="{Binding Path=Command}">
              <TextBlock Text="{Binding Path=DisplayName}" />
            </Hyperlink>
          </TextBlock>
        </DataTemplate>
      </ItemsControl.ItemTemplate>
    </ItemsControl>
  </DataTemplate>

  <!-- 
  This template explains how to render 
  a tab item with a close button.
  -->
  <DataTemplate x:Key="ClosableTabItemTemplate">
    <DockPanel MinWidth="10">
        <Button Command="{Binding Path=CloseCommand}"
                Style="{StaticResource CloseableTabItemButtonStyle}"
                Content="X"
                Cursor="Hand"
                DockPanel.Dock="Right"
                Focusable="False"
                FontFamily="Courier" 
                Foreground="Gray"
                FontSize="9"
                FontWeight="Bold"  
                Margin="6,-2,-6,0"
                Padding="0"
                VerticalContentAlignment="Center" HorizontalAlignment="Center"
                Width="16" Height="16" 
                />
        <ContentPresenter 
                Content="{Binding Path=DisplayName}" 
                VerticalAlignment="Center" 
                />
    </DockPanel>
  </DataTemplate>
    
 
    <Style x:Key="TabItemCloseButtonStyle" TargetType="{x:Type Button}">

        <Setter Property="SnapsToDevicePixels" Value="false"/>

        <Setter Property="Height" Value="{StaticResource CloseButtonWidthAndHeight}"/>

        <Setter Property="Width" Value="{StaticResource CloseButtonWidthAndHeight}"/>

        <Setter Property="Cursor" Value="Hand"/>

        <Setter Property="Focusable" Value="False"/>

        <Setter Property="OverridesDefaultStyle" Value="true"/>

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type Button}">

                    <Border x:Name="ButtonBorder"   

                          CornerRadius="2"  

                          BorderThickness="1" 

                          Background="{StaticResource TabItemCloseButtonNormalBackgroundBrush}" 

                          BorderBrush="{StaticResource TabItemCloseButtonNormalBorderBrush}">

                        <Grid>

                            <!-- The Path below will render the button's X. -->

                            <Path x:Name="ButtonPath"  

                              Margin="2" 

                              Data="{StaticResource X_CloseButton}" 

                              Stroke="{StaticResource TabItemCloseButtonNormalForegroundBrush}"  

                              StrokeThickness="2" 

                              StrokeStartLineCap="Round" 

                              StrokeEndLineCap="Round" 

                              Stretch="Uniform" 

                              VerticalAlignment="Center" 

                              HorizontalAlignment="Center"/>

                            <!-- We don't really need the ContentPresenter, but what the heck ... -->

                            <ContentPresenter HorizontalAlignment="Center" 

                                          VerticalAlignment="Center"/>

                        </Grid>

                    </Border>

                    <ControlTemplate.Triggers>

                        <Trigger Property="IsMouseOver" Value="True">

                            <Setter TargetName="ButtonBorder"  

                          Property="Background"  

                          Value="{StaticResource   

                             TabItemCloseButtonHoverBackgroundBrush}" />

                            <Setter TargetName="ButtonPath"  

                          Property="Stroke" 

                          Value="{StaticResource   

                             TabItemCloseButtonHoverForegroundBrush}"/>

                        </Trigger>

                        <Trigger Property="IsEnabled" Value="false">

                            <Setter Property="Visibility" Value="Collapsed"/>

                        </Trigger>

                        <Trigger Property="IsPressed" Value="true">

                            <Setter TargetName="ButtonBorder"  

                                Property="Background"  

                                Value="{StaticResource   

                                   TabItemCloseButtonPressedBackgroundBrush}" />

                            <Setter TargetName="ButtonBorder"  

                                Property="BorderBrush"  

                                Value="{StaticResource   

                                   TabItemCloseButtonPressedBorderBrush}" />

                            <Setter TargetName="ButtonPath" Property="Stroke"  

                                Value="{StaticResource   

                                   TabItemCloseButtonPressedForegroundBrush}"/>

                            <Setter TargetName="ButtonPath"  

                          Property="Margin" Value="2.5,2.5,1.5,1.5" />

                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

    <!--
  This template explains how to render the 'Workspace' content area in the main window.
  -->
  <DataTemplate x:Key="WorkspacesTemplate">
        <TabControl IsSynchronizedWithCurrentItem="True" 
                    ItemsSource="{Binding}" 
                    ItemTemplate="{StaticResource ClosableTabItemTemplate}"
                    Margin="4"
                    Background="{DynamicResource WindowBackground}"
      />
    </DataTemplate>

</ResourceDictionary>

